﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CH03_03
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("AGV控制指令(W:前进,A:左转,X:后退,D:右转,S:制动)");
            Console.WriteLine("请输入AGV控制指令:");

            char inputChar = Console.ReadKey().KeyChar;
            char processedChar = (char.IsControl(inputChar) || char.IsWhiteSpace(inputChar)) ? '\0' : char.ToUpper(inputChar);

            switch (processedChar)
            {
                case 'W':
                    Console.Write("\n");
                    Console.WriteLine("AGV正在向前运动...");
                    break;
                case 'A':
                    Console.Write("\n");
                    Console.WriteLine("AGV正在进行左转...");
                    break;
                case 'X':
                    Console.Write("\n");
                    Console.WriteLine("AGV正在向后运动...");
                    break;
                case 'D':
                    Console.Write("\n");
                    Console.WriteLine("AGV正在进行右转...");
                    break;
                case 'S':
                    Console.Write("\n");
                    Console.WriteLine("AGV正在进行制动...");
                    break;
            }

            Console.WriteLine("Press any key to close the program...");
            Console.ReadKey();
        }
    }
}
